﻿using System;
using System.ComponentModel;
using System.Web.UI.WebControls.WebParts;

namespace SPCountdown.SPCountdownWebPart
{
    [ToolboxItemAttribute(false)]
    public class SPCountdownWebPart : WebPart
    {
        // Visual Studio might automatically update this path when you change the Visual Web Part project item.
        private const string _ascxPath = @"~/_CONTROLTEMPLATES/SPCountdown/SPCountdownWebPart/SPCountdownWebPartUserControl.ascx";

        protected override void CreateChildControls()
        {
            var control = Page.LoadControl(_ascxPath);
            if (control != null)
            {
                ((SPCountdownWebPartUserControl)control).WebPart = this;
            }
            Controls.Add(control);
        }


        [Category("Countdown Settings"),
        Personalizable(PersonalizationScope.Shared),
        WebBrowsable(true),
        WebDisplayName("Target Date/Time"),
        WebDescription("Please enter the target date/time for countdown.")]
        public DateTime TargetDate { get; set; }
    }
}
